package com.changgou.pay.feign;

import com.changgou.entity.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

/**
 * @Author: HuangFu
 * @Date: 2020/2/19 11:11
 * @Description:
 */
@FeignClient(name = "pay")
public interface WxPayFeign{

    /**
     * 微信下单
     * @param orderId
     * @param money
     * @return
     */
    @GetMapping("/wxpay/nativePay")
    Result<Map> nativePay(@RequestParam("orderId") String orderId
            , @RequestParam("money") Integer money);

    /**
     * 查询微信订单根据订单ID
     * @param orderId
     * @return
     */
    @GetMapping("/wxpay/query/{orderId}")
    Result<Map> queryOrder(@PathVariable("orderId") String orderId);

    /**
     * 关闭订单
     * @param orderId
     * @return
     */
    @PostMapping("/close/{orderId}")
    Result<Map> closeOrder(@PathVariable("orderId") String orderId);
}
